package org.nicocube.airain.gwt.client.ui;

import org.nicocube.airain.domain.client.utils.Publisher;
import org.nicocube.airain.domain.client.utils.Subscriber;

import com.google.gwt.user.client.ui.Label;

public abstract class ObserverLabel<P extends Publisher> extends Label implements Subscriber {

	public ObserverLabel(P publisher) {
		super();
		publisher.subscribe(this);
		update(publisher);
	}

	//@Override
	@SuppressWarnings("unchecked")
	public void update(Publisher o) {
		setText(render((P)o));
	}

	public abstract String render(P arg);

}
